package webCam;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



import AplicacionMVC.Vistas;
import funciones.Medico;
import funciones.PacienteCita;
import java.awt.Dimension;
import java.awt.Graphics;
import java.net.URL;
import java.util.ArrayList;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;

/**
 *
 * @author Jesus Ruiz Oliva
 */
public class IniciarCamara extends JFrame{
   public IniciarCamara(ArrayList<String> arrayFotos){
       VistaWebCam vistaWebCam = new VistaWebCam(){
            @Override
            public void paintComponent(Graphics g)
            {
                URL url = getClass().getResource("/imagenes/cam.jpg");
                if(url != null)
                {
                    Dimension tamanio = getSize();
                    ImageIcon fondo = new ImageIcon(url);
                    g.drawImage(fondo.getImage(), 0, 0, tamanio.width, tamanio.height, null);
                    setOpaque(false);
                    super.paintComponent(g);
                }
            }
        };

        final Camara webCam = new Camara();
        ControllerCamaraWeb controllerCamaraWeb = new ControllerCamaraWeb(vistaWebCam,webCam,arrayFotos,this);
        vistaWebCam.addListener(controllerCamaraWeb);
        vistaWebCam.addMouseActionListener(controllerCamaraWeb);
        vistaWebCam.addMouseMotionListener(controllerCamaraWeb);
        //JFrame f = new JFrame();
        setSize(1200, 800);
        setExtendedState(JFrame.MAXIMIZED_BOTH);
        setResizable(true);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);        
        
        add("Center", vistaWebCam);
              
        setVisible(true);
   }
 /* public static void main(String[] args) {
        VistaWebCam vistaWebCam = new VistaWebCam();
        final Camara webCam = new Camara();
        ControllerCamaraWeb controllerCamaraWeb = new ControllerCamaraWeb(vistaWebCam, webCam);
        vistaWebCam.addListener(controllerCamaraWeb);
        vistaWebCam.addMouseActionListener(controllerCamaraWeb);
        vistaWebCam.addMouseMotionListener(controllerCamaraWeb);
        JFrame f = new JFrame();
        f.setSize(1200, 800);
        f.setExtendedState(JFrame.MAXIMIZED_BOTH);
        f.setResizable(true);
         f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);        
        
        f.add("Center", vistaWebCam);
              
        f.setVisible(true);
    }*/
}
